<?php
require_once './libs/Base.php';

$Base=new Base();
//判断微信端
if(!$Base->isWechatClient()){
    exit('请在用微信打开该页面');
}
//订单号
$orderSn=time();
//客户端ip
$clientIP=$Base->getClientIP();
//用户信息
$userInfo=$Base->getUserInfo();
?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>下单</title>
    <style>
        .input-container{
            margin-bottom: 10px;
        }
        .input-container label{
            width: 100px;
            text-align: right;
        }
        .input-container input,.input-container textarea{
            width: 300px;
        }
    </style>
</head>
<body>
<form action="./libs/PlaceOrderJsapi.php" method="post">
    <div class="input-container">
        <label>公众账号ID</label>
        <input type="text" name="appid" value="wx0f031682e7eba20b">
    </div>
    <div class="input-container">
        <label>商户号</label>
        <input type="text" name="mch_id" value="1364019302">
    </div>
    <div class="input-container">
        <label>子商户号</label>
        <input type="text" name="sub_mch_id" value="1539027741">
    </div>
    <div class="input-container">
        <label>随机字符串</label>
        <input type="text" name="nonce_str" value="<?php echo md5(time());?>">
    </div>
    <div class="input-container">
        <label>签名类型</label>
        <input type="text" name="sign_type" value="MD5">
    </div>
    <div class="input-container">
        <label>商品描述</label>
        <input type="text" name="body" value="Test-<?php echo $orderSn;?>">
    </div>
    <div class="input-container">
        <label>商户订单号</label>
        <input type="text" name="out_trade_no" value="<?php echo $orderSn;?>">
    </div>
    <div class="input-container">
        <label>总金额（单位：/分）</label>
        <input type="text" name="total_fee" value="20">
    </div>
    <div class="input-container">
        <label>终端IP</label>
        <input type="text" name="spbill_create_ip" value="<?php echo $clientIP;?>">
    </div>
    <div class="input-container">
        <label>交易类型</label>
        <input type="text" name="trade_type" value="JSAPI">
    </div>
    <div class="input-container">
        <label>用户标识</label>
        <input type="text" name="openid" value="<?php echo $userInfo['openid'];?>">
    </div>
    <div class="input-container">
        <label>通知地址</label>
        <input type="text" name="notify_url" value="<?php echo $Base->url.'/xiaowei_demo/libs/callback/NotifyJsapi.php';?>">
    </div>
    <input type="submit" value="提交">
</form>
</body>
</html>